Methods
(static) sliceStringAt(range) → {function}
- Source:
- Since:
- 0.5.0
- See:
Return a function extracting the portion of a string between the provided indices (first included, second excluded). Note that indices can be negative.
Example
> slicerPosPos = sliceStringAt([3, 5])
> slicerPosPos('0123456789')
'34'
> slicerPosImplicit = sliceStringAt([3])
> slicerPosImplicit('0123456789')
'3456789'
> slicerPosNeg = sliceStringAt([1, -3])
> slicerPosNeg('0123456789')
'123456'
> slicerNegPos = sliceStringAt([-6, 6])
> slicerNeg3('0123456789')
'45'
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
range |
Array.<number> | [beginIndex, endIndex] Properties
|
Returns:
- Function - String -> Boolean
- Type
- function